Add mcp-youtube MCP server for downloading YouTube subtitles - #3
Add mcp-youtube MCP server for downloading YouTube subtitles#3RiCSaucd wants to merge 2 commits into
Conversation
Implements the @anaisbetts/mcp-youtube package: an MCP stdio server exposing a download_youtube_url tool that fetches English subtitles via yt-dlp, strips VTT/SRT timing and markup noise, and returns the transcript so Claude can summarize YouTube videos. Includes bun tests for the subtitle cleaner, tsconfig, and README. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDZyqVgbhHovtSKV4gzyRh
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new standalone mcp-youtube/ MCP stdio server package that downloads and cleans YouTube subtitles via yt-dlp, enabling downstream clients to consume transcript text.
Changes:
- Introduces an MCP server with a
download_youtube_urltool that invokesyt-dlpand returns cleaned subtitle text. - Adds
stripVttNoisesubtitle-cleaning helper with Bun unit tests. - Adds package scaffolding (README, tsconfig, lockfile, gitignore) for publishing/building.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
mcp-youtube/src/index.ts |
Implements MCP server tool and subtitle-cleaning helper. |
mcp-youtube/test/strip-vtt-noise.test.ts |
Adds Bun tests for subtitle-cleaning behavior. |
mcp-youtube/package.json |
Defines package metadata, bin entry, deps, and scripts. |
mcp-youtube/tsconfig.json |
TypeScript configuration for the project. |
mcp-youtube/README.md |
Documents usage, prerequisites, and development commands. |
mcp-youtube/bun.lock |
Locks dependency versions for Bun. |
mcp-youtube/.gitignore |
Ignores build output and node_modules. |
Suppressed comments (1)
mcp-youtube/src/index.ts:144
- This entrypoint check is fragile when process.argv[1] is relative. Resolve argv[1] and convert it to a file URL before comparing to import.meta.url.
if (import.meta.url === `file://${process.argv[1]}`) {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Validate the input URL is an http(s) YouTube URL before invoking yt-dlp - Collapse only consecutive duplicate subtitle lines so legitimately repeated phrases later in the transcript are preserved - Filter temp-dir reads to .srt/.vtt files and return an error instead of an empty success when no subtitles were downloaded - Fix the direct-execution guard to compare against pathToFileURL(argv[1]) so the server starts reliably via node/npx with relative paths - Run yt-dlp non-detached to avoid orphaned processes - Reword the error message (subtitles, not video) and make the tool description client-agnostic - Use prepublishOnly instead of the legacy prepublish hook - Pin bun-types to ^1.3.14 instead of latest Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDZyqVgbhHovtSKV4gzyRh
Summary
Implements the
@anaisbetts/mcp-youtubepackage (v0.7.3) as a newmcp-youtube/project: a Model Context Protocol stdio server that lets Claude read YouTube video subtitles so it can summarize and answer questions about video content.What's included
src/index.ts— MCP server exposing a singledownload_youtube_urltool. It runsyt-dlpto fetch English subtitles (manual or auto-generated, converted to SRT) into a temp directory, cleans out WEBVTT headers, timing lines, sequence numbers, inline tags, and duplicated auto-caption cues, and returns the transcript text. Temp files are cleaned up withrimrafin all paths.test/strip-vtt-noise.test.ts— Bun tests for the subtitle-cleaning helper (4 passing).package.json— as specified in the task, with"type": "module"added so the ESM build runs under Node.tsconfig.json,README.md(install/usage docs incl.yt-dlpprerequisite),.gitignore,bun.lock.Verification
bun test: 4 pass, 0 failbun build --target node src/index.ts --outdir distsucceedsinitialize+tools/listcorrectly returns thedownload_youtube_urltool🤖 Generated with Claude Code
https://claude.ai/code/session_01UDZyqVgbhHovtSKV4gzyRh
Generated by Claude Code